package com.moxi.mogublog.admin.restapi.xuan;


import com.moxi.mogublog.admin.annotion.AvoidRepeatableCommit.AvoidRepeatableCommit;
import com.moxi.mogublog.commons.vo.BlogVO;
import com.moxi.mogublog.xo.service.xuan.WebBlogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/webService")
@Api(value = "web端添加相关接口", tags = {"web端添加相关接口"})
@Slf4j
public class WebServiceRestApi {

    @Autowired
    private WebBlogService webBlogService;

    @AvoidRepeatableCommit
    @ApiOperation(value = "web增加博客", notes = "web增加博客", response = String.class)
    @PostMapping("/addBlog")
    public String addBlog(@RequestBody BlogVO blogVO) {
        return webBlogService.addBlog(blogVO);
    }


    @ApiOperation(value = "web编辑博客", notes = "web编辑博客", response = String.class)
    @PostMapping("/editBlog")
    public String editBLog(@RequestBody BlogVO blogVO) {
        return webBlogService.editBlog(blogVO);
    }



    @GetMapping("/test")
    public String test(){
        log.warn("******************************* test ");
        return "test";
    }

}
